import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Search from '@/views/Search'
import Info from '@/views/Info'
import My from '@/views/My'
import Login from '@/views/Login'
import Registe from '@/views/Registe'
import Favorite from '@/views/Favorite'
import Detail from '@/views/Detail'
import Rent from '@/views/Rent'
import Map from '@/views/Map'
import City from '@/views/City'
import RentAdd from '@/views/RentAdd'
import RentSearch from '@/views/RentSearch'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '',
        component: Home
      },
      {
        path: '/search',
        component: Search
      },
      {
        path: '/info',
        component: Info
      },
      {
        path: '/my',
        component: My
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  { path: '/registe', component: Registe },
  { path: '/detail/:id', component: Detail },
  { path: '/favorite', component: Favorite },
  { path: '/rent', component: Rent },
  { path: '/rent/add', component: RentAdd },
  { path: '/map', component: Map },
  { path: '/city', component: City },
  { path: '/rent/search', component: RentSearch }

]

const router = new VueRouter({
  routes
})

export default router
